Guinan wears a hat. Other than that, it is likely against Starfleet Protocol, as earrings, scuffed boots, unzipped collars, and similar infractions are not tolerated. (Voyager: Learning curve)
But nobody wears a cowboy hat. :( Not even civilians. >>Data wore a cowboy hat briefly in the casino lobby of the Royale hotel on Theta VIII in ST:TNG "The Royale" ProfessorTrek 02:57, August 7, 2011 (UTC)
Data wore a hat when he was sherlock holmes
Wolf wore a hat in Alexanders cowboy holoprograms.
Lwaxana Troi wears hats with most of her outfits.
Captain Archer and other crewmen are seen wearing baseball caps, monogrammed with the registry of the Enterprise, NX-01.
Starfleet Security Personnel in STIII:TSFS are seen wearing helmets.
DarthLucifer 18:09, August 26, 2011 (UTC)
Nobody had better headwear than the Bajoran Vedeks who wore those purple Sydney Opera House-looking hats.