Optical sensor for carbon dioxide combining colorimetric change of a pH indicator and a reference luminescent dye