The Rambam's ten requirements for the person who dwells within to be obligated to affix a mezuzah. If one of the requirements is lacking, there is no Torah obligation for a mezuzah.
The area of the room must be four cubits by four cubits or more; - 36 square feet
The doorway needs to have two doorposts. The Turei Zahav 287:1 and the Kitzur Shulchan Aruch 11:11, state that if a doorway has a doorpost on the right side and a wall which continues on the left side, a mezuzah should be affixed without a blessing. If the doorpost is on the left side, and the wall continues on the right, there is no need for a mezuzah.
The doorway must have a lintel; - a beam above the doorposts. According to many authorities, the ceiling of the house is not considered to be a lintel.
The room must have a roof.
The doorway must have a door. The Shulchan Aruch (Yoreh De'ah 286:15) obligates us to place a mezuzah even on entrances which do not have doors. Nevertheless, in deference to the Rambam's opinion, the Siftei Cohen 286:25 states that a person should not recite a blessing when affixing such a mezuzah.
The doorway needs to be at least 16 inches (ten hand breadths) high; - If the doorway is not at least this high, it is not fit to be used by adults.
A synagogue sanctuary or Beth Hamidrash does not require a mezuzah.
The room needs to be for human habitation. This principle is not accepted by all authorities.
The room needs to be used for a dignified dwelling; not a bathroom or place dirty objects are stored.
The room needs to be used for permanent dwelling. In Israel even if used for one night like a hotel room it requires a mezuzah. Outside Israel it needs to be used for thirty days or more to be liable a mezuzah.