Both Mind Blank and the Ring of Mind Shielding provide an absolute protection against the Dream spell.
Mind Blank's text (emphasis mine) states:
Until the spell ends, one willing creature you touch is immune to psychic damage, any effect that would sense it's emotions or read its thoughts, divination spells, and the charmed condition. The spell even foils wish spells and spells or effects of similar power used to affect the target's mind or to gain information about the target.
This last line provides an absolute protection against any spell that would affect the target's mind.
Dream states (emphasis mine):
This spell shapes a creature's dreams. Choose a creature known to you as the target of this spell. The target must be on the same plane of existence as you. Creatures that don't sleep, such as elves, can't be contacted by this spell. You, or a willing creature you touch, enters a trance state, acting as a messenger. While in the trance, the messenger is aware of his or her surroundings, but can't take actions or move.
If the target is asleep, the messenger appears in the target's dreams and can converse with the target as long as it remains asleep, through the duration of the spell. The messenger can also shape the environment of the dream, creating landscapes, objects, and other images. The messenger can emerge from the trance at any time, ending the effect of the spell early. The target recalls the dream perfectly upon waking. If the target is awake when you cast the spell, the messenger knows it, and can either end the trance (and the spell) or wait for the target to fall asleep, at which point the messenger appears in the target's dreams.
You can make the messenger appear monstrous and terrifying to the target. If you do, the messenger can deliver a message of no more than ten words and then the target must make a Wisdom saving throw. On a failed save, echoes of the phantasmal monstrosity spawn a nightmare that lasts the duration of the target's sleep and prevents the target from gaining any benefit from that rest. In addition, when the target wakes up, it takes 3d6 psychic damage.
The very first sentence of Dream means the entire spell falls under the catch-all of "spells or effects of similar power used to affect the target's mind or to gain information about the target" at the end of Mind Blank.
If that wasn't enough, both:
- the benign use, to appear in the target's dreams and shape the dream or converse with the target (thus affecting their thoughts [dreams]),
- or making a terrifying eminence within their dream that creates echos so terrifying in their dream that affects them, that they gain no benefit of that rest
would fall under the definition of affecting the targets thoughts, and thus be prevented by Mind Blank.
The Ring of Mind Shielding is more complicated, since it's not quite as explicit. It's text states:
While wearing this ring, you are immune to magic that allows other creatures to read your thoughts, determine whether you are lying, know your alignment, or know your creature type. Creatures can telepathically communicate with you only if you allow it.
Now we ask two questions:
- Is being able to see and affect your dreams "read[ing] your thoughts"?
Certainly, being able to enter and observe your dreams would count as reading your thoughts (as the messenger will remember the dream they observed).
- Does Dream cause the messenger to telepathically communicate with you?
While Dream doesn't explicitly say the communication is telepathic, the communication initiated by Dream is mind to mind communication. This is pretty much the definition of telepathic communication, and as such would be blocked by the Ring of Mind Shielding.
Is there anything else that provides such a protection?
In the Waterdeep: Dragon Heist adventure sourcebooks there is a magic item that provides this protection:
The item's description states, in part (p. 191):
[...] and you are immune to magic that allows other creatures to read your thoughts, to determine whether you are lying, to know your alignment, or to know your creature type.
In addition, an Antimagic field will protect you absolutely from the Dream spell (emphasis mine):
[...] Spells and other magical effects, except those created by an artifact or a deity, are suppressed in the sphere and can't protrude into it. A slot expended to cast a suppressed spell is consumed. While an effect is suppressed, it doesn't function, but the time it spends suppressed counts against its duration.[...]
Since Dream is a spell it cannot protrude into an Antimagic Field.
Finally, any spell or effect which allows you to temporarily be on a different plane of existance, like Etheralness, Mordenkainen's Magnificent Mansion, or Demiplane will protect you as they prevent the requirement of the Dream spell that:
The target must be on the same plane of existence as you.