Heh, hat rack is two words here. I've always liked "breakfast." I think I learned at a very young age its breakdown, and always liked the word for it.
It's important not to let orthography fool you: "hatrack," whether spelled with a space, no space, or a hyphen, counts as a word -- a compound word, for sure, but still a word in and of itself. Notice its stress profile: there's only one instance of primary stress, on the first syllable (so, it's ['hæʔɹæk], not ['hæʔ'ɹæk]), which is characteristic of English wordhood; compare, say, the compound "blackbird," with only one instance of primary stress on the first syllable, to the phrase "black bird," which has two instances (the same goes for "greenhouse" vs. "green house").
A quick rule-of-thumb is to notice that you've got two nouns, and that noun-noun compounding in English is highly productive, meaning you're likely dealing with a compound. Moreover, while its meaning is transparent enough, it isn't necessarily
so; the word could have just as easily come to mean a rack shaped like a hat, or one made out of hats, or something even more creative.