how do you think hydrogen is produced?
electricity + hydrocarbon (most likely fossil fuel) = hydrogen + carbon fuel source burned to produce electricity.
or a less efficient process:
electricity + water = hydrogen + oxygen
and where does all that electricity come from today?
Yep, fossil fuel.
So, a hydrogen power car is worse than a battery power car in terms of CO2.