According to MinecraftWiki:
Ghasts are able to spawn anywhere in the Nether, as long as there is sufficient space.
Exactly how much space do they need? If one builds a base in the Nether how can it be made immune to ghast spawning?
Edit: As GnomeSlice points out ghasts (as they were originally intended) occasionally spawn in the regular world near portals. In an effort to be thorough with preventing unwanted ghasts, what is the maximum distance from a portal that a ghast can spawn in the normal world?
Best Answer
Sufficient space for a ghast is a 5x5x5 cube.
Source
(Presumably in the time between Alpha 1.2 and the current version, Beta 1.6, Ghasts now definitely behave as originally intended)
Ghasts do not spawn in the normal world, despite Notch's earlier intentions.
Source (jeb)