The Magenta Ostrich Hat is a unique hat that can only be obtained during the Raven's Cove Story Quest (available at notoriety level 30) by earning the bonus quest playing Undead Poker for the friendly Clubheart ghosts. Once you sell this hard-earned hat, there is no way of getting it back.
It requires a very difficult task, winning 5,000 gold in Undead Poker without dying, which can be challenging for some. When you are playing, you are playing undead enemies that you can fight in the game. If you finish the quest without doing this extra, you will not be able to go back and get it.