Perhaps the hair is actually their gills?
Oxygen is not very soluble in water. One liter of water can dissolve about 22 micro-moles of oxygen gas. For comparison, if I've prodded WolframAlpha correctly, one liter of air contains about 9200 micro-moles of oxygen. That's over 400 times as much!
Due to this, I'm not entirely sure that it's possible for a set of gills that fits within a human chest cavity to extract enough oxygen from water in order to keep a human body and a human brain from asphyxiating. I don't have hard science to back up that hunch, and I could well be completely wrong about it if I've grossly overestimated how much oxygen a human body actually needs and how much water can be pumped through a set of gills, but... it's enough to make me doubt that water-breathing mermaids with internal gills could be viable.
However, there is a workaround: External gills! Mermaids' "hair" could actually be a veritable forest of external gills that could pass for voluminous hair at a glance. They'd likely live either in rivers or in tidal estuaries, where they can cling to the bottom and let the current wash fresh, oxygenated water over their gills.
Those gills would produce a lot of drag when the mermaids swim- they would not be able to swim very efficiently, and would have a hard time swimming fast. They might even drown if caught in the open ocean- swimming under their own power may consume more oxygen than it allows their gills to gather.
Perhaps they might be able to flatten their gills against their bodies, making themselves more streamlined at the expense of not being able to breathe. Then they could dart from one place to another when they've consumed all the oxygen in their immediate vicinity. This, plus being able to dramatically slow down their metabolism when sleeping, could allow them to survive in the open ocean.
I suspect these mermaids would have a hard time competing against, say, sharks or dolphins. Or, for that matter, against fully-mammalian air-breathing mermaids whose hair is, as other answers have suggested, a vestigial remnant of when they lived on land.