Again check out the Ballard page
Here's the page on how it works.
http://www.ballard.com/be_informed/fuel_cell_technology/how_the_technology_works
Hydrogen can be supplied to a fuel cell directly or may be obtained from natural gas, methanol or petroleum using a fuel processor, which converts the hydrocarbons into hydrogen and carbon dioxide through a catalytic chemical reaction.
There are just a couple of problems with that process.
1. If producing hydrogen is going to produce carbon dioxide, a greenhouse gas, it would be much more efficient to just burn the hydrocarbon in the first place (and besides, there's no real value to burning hydrogen, since you won't be reducing the production of greenhouse gases, you'll just be producing them somewhere besides in your automobile).
2. Energy has to be supplied to break the hydrocarbon into hydrogen and carbon dioxide - where do you get that energy, and how much pollution is produced in supplying it?
Also, forgot to add, if we're getting the hydrogen by breaking down petroleum or natural gas, it doesn't reduce our dependence on fossil fuels.