A fantasy in a dream generally signifies the need to escape reality. It can also represent creativity, as the person may be using their imagination to open up new possibilities.
For example, a woman dreams that she is pregnant and unable to get out of a room with many doors, each one guarded by a demon. The woman finds her way past all of the demons and delivers her baby, making her happy. She then wakes up from the dream and realizes that there is no way that she could have gotten pregnant in real life because she is not even dating anyone at this time but feels relieved nonetheless through her fantasy.
Another example, a man has been working on an idea for his business for so long that he has lost sight of what it was he wanted to do in the first place. He imagines himself sitting on a beach reading a novel for over an hour and then he wakes up from the vacation fantasy of a dream with clarity about what he should do next with his business idea.