A hat or cap is a symbol of wisdom and the intellect and also of protection.

It can also signify both spirituality and sexuality, depending on the other aspects of the dream.