The oxygen atoms liberated as molecular oxygen by the photosynthesis the process comes from water.
One indeed could suspect that those oxygen atoms would have come from carbon dioxide. Oxygen atoms from carbon dioxide however are incorporated into glucose molecules and into water molecules liberated in the chemical stage of photosynthesis.