Fast measurement of the CO2 partial pressure in gases and fluids