Minecraft wiki entry for Dungeon, associated text: The floor area (including under the walls) of the potential dungeon must be entirely solid.
The ceiling area (including over the walls) of the potential dungeon must be entirely solid. The ceiling blocks may be gravity-affected such as gravel or sand, which fall if disturbed by the player.
The walls of the potential dungeon must have 1–5 openings (2-high air blocks) at floor level.