Air contains several gases mixed together. The total pressure is the combination of the separate gases. The individual gases each fill the entire volume of the container because of rule #1 of the KMT, gases molecules take up zero space.
Gases produced in a reaction can be "collected over water" by displacing water in an inverted container. However the gas is not pure. Water vapor is mixed in with the gas, so we cannot directly measure the pressure and therefore the amount of the gas created.
We can use the law of partial pressures to determine the amount of gas created.
PTotal = Pgas + PO2
or
Pgas = PTotal - PO2
The pressure of water is dependent on temperature.