CO is formed when there's not enough oxygen to form the CO2 produced by fire under normal conditions. So you're absolutely correct that CO forms in an enclosed space, however that space needs to be small, like a combustion engine. In a room where humans are able to be and breath, it's safe to assume that there's enough oxygen around to form CO2.

Fire is made by combing Carbon(the wood you're burning), C, with Oxygen(from the air around it), O2. When you combine those two, you end up with CO2(C+O2=CO2).