I’ve never got on with full hats that cover the whole of the top of the head when I’m on a bike. I find that they are too hot and too sweaty
However, I got a new hat for my birthday last month, an Assos S7 raincap. It’s not just a standard cotton cap although it looks like one. The clue is in the name, yes it is water proof.
I’ve been wearing it on it’s own and under my helmet and it is indeed waterproof. It is also breatheable enough to mean that it is possible to wear it, if it isn’t too warm.
It was a gift and apparently it was phenomenally expensive. Although it looks like it is made from Gaffer tape!