It’s not about the oxygen!
This question indicates two misplaced concerns. One is with oxygen. I imagine that this is because of its importance to us as animals; however as far as photosynthesis is concerned oxygen is just a waste product. The other is with a chemical equation, which is as informative as the top line of a commercial balance sheet. One's focus should be on the chemical problem and what is needed to solve it.
The problem is making sugar from carbon dioxide
The purpose of photosynthesis is to make sugar from carbon dioxide. Why is this a problem?
- The individual carbons in the carbon dioxide have to be joined together with C-C bonds. This requires energy (in the biological form of ATP).
- In sugars most of the oxygen atoms are in OH groups. So we need to convert the C=O of the carbon dioxide to C–OH (not throw the oxygen away). This is reduction of the carbon, and requires ‘reducing power’ (in the form of the NADPH) which also requires energy input.
The sun solves the problem by supplying the energy
The energy for creating the reducing NADPH and the ATP comes from the sun in a complex series of reactions that do not involve carbon dioxide. Light of a particular wavelength is used to break a water bond so as to separate charge in a reaction that I will deliberately not balance:
(1) H2O → O2 + H
A complex series of reactions transfer the H (more strictly an electron) between different molecules, eventually reducing NADP+ to NADPH. At the same time an equally complex process builds up a H+ concentration difference across a membrane which provides the energy to convert ADP to ATP.
To reiterate, the reaction uses light energy to generate chemical energy in the form of NADPH and ATP. Oxygen is just flushed down the toilet.
Now for the Lego bricks — so easy we can do it in the dark
Having harvested the energy of the sun we have money in the bank which we can spend whenever we want — day or night — to make sugar from carbon dioxide. The overall unbalanced equation is:
(2) CO2 + NADPH + ATP → C6H12O6 + NADP+ + ADP
but this is actually a complex series of enzyme-catalysed reactions (known as the Calvin Cycle if you must know).
You still want to know the answer?
The oxygen produced in photosynthesis comes from water because this is the molecule in which a bond is broken by sunlight to separate charge allowing synthesis of molecules with reducing power and energy transfer potential. Carbon dioxide is the building block of the sugar and far from breaking a C=O bond, what is needed is for it to be converted to C-OH by reduction of the carbon.