"I washed my hair in the bath."
On a cultural note, be aware that in Japan you are generally expected to wash your hair and body outside of the bath, rinse, and then enter the bath for soaking. It is common for the same bath water to be used by multiple family members (or patrons at a public bath) so it is considered bad to make the water soapy by washing yourself in it.
に is an indicator of a destination or a place of existence. 学校に行きます = I go to the school. 学校にいます = I am at the school.
で is the place of an action レストランで食べます = i eat at the restaurant.
In many sentences both can be used, but the meaning becomes different. そこに投げる = I throw it to there. そこで投げる = I throw it from there.