Plants respire all the time, whether it is dark or light, because their cells need energy to stay alive. But they can only photosynthesize when they have light.
The oxidation of water occurs during photosynthetic electron transport during the light reactions of photosynthesis. In the absence of a source of light energy (dark reactions have no direct requirement for light energy), oxygen is not produced.