We tend to use the definite form sometimes when English prefers to include a possessive pronoun. This happens when it's clear from context whose object we're talking about. The perfect example is Jag borstar tänderna 'I brush my teeth'. Whose teeth would you expect me to brush? – It isn't wrong to say Jag borstar mina tänder in Swedish, but it's less idiomatic. With hatten, it's a little less obvious, but still you'd be most likely to hold on to your own hat. If you want to tell someone to hold on to your hat, you'd have to say Håll i min hatt!, because that wouldn't be the default choice.