As I recall compressing and storing hydrogen is a very expensive process. One problem is that hydrogen likes to destroy most metals. Any piping, compressor, or container must be made of expensive metals or lined with glass or something.
While this is true, the really expensive part is the high-pressure tank. It has to be fairly extreme to actually hold the hydrogen, let alone the issue of sealing it against the gas which is basically a solved problem. We already are using expensive alloys for common engines now that gasoline direct injection has become common. The big difference in practice now is that a gas tank is stamped out of sheet metal and costs basically nothing, and a hydrogen tank is made out of carbon fiber and titanium or aluminum and costs a bundle.
I might be mistaken but hydrocarbon liquids can store hydrogen in a much smaller space than any compressed gas.
It's true. The problem is, burning them produces undesirable emissions. When you burn hydrogen gas you get water vapor and heat out the other end; the emissions truly are cleaner than the intake air. When you burn gasoline you get soot and carbon monoxide. You can minimize the CO, you can reduce the soot, but you can't make them go away. When you burn diesel you get less of everything but NOx, but then you get NOx. So what do you burn? Probably the "best" thing would be methane. It has similar energy density problems to hydrogen, but it has dramatically lower pressure requirements and it doesn't require exotic alloys. Any gasoline engine can be converted to run on it fairly cheaply, at least in theory. (Doing it very cheaply requires automaker cooperation and a vehicle with a reprogrammable PCM, but you can do it "from scratch" without much cash outlay to carbureted vehicles as well — and basically turn them fuel-injected in the process, or you can just use a vacuum-controlled gas regulator which behaves like a carb. Both approaches are commonly used in propane conversions. Methane vs. propane means a very slightly different working pressure, and different injector timing or regulator adjustment.