Below is a list of all hats and how they can/could be obtained.
Hive Store Hats
The following hats can currently be purchased from the Hive Store:

Can be purchased on the Hive Store.
Rarity: Epic

Can be purchased on the Hive Store.
Rarity: Rare

Can be purchased on the Hive Store.
Rarity: Uncommon

Can be purchased on the Hive Store.
Rarity: Uncommon

Can be purchased on the Hive Store.
Rarity: Uncommon

Can be purchased on the Hive Store.
Rarity: Rare

Obtained by purchasing the Broomstick mount.
Rarity: Uncommon

Can be purchased on the Hive Store.
Rarity: Uncommon

Can be purchased on the Hive Store.
Rarity: Uncommon

Can be purchased on the Hive Store.
Rarity: Rare

Can be purchased on the Hive Store.
Rarity: Epic

Can be purchased on the Hive Store.
Rarity: Epic

Can be purchased on the Hive Store.
Rarity: Rare

Can be purchased on the Hive Store.
Rarity: Uncommon

Can be purchased on the Hive Store.
Rarity: Epic

Can be purchased on the Hive Store.
Rarity: Epic

Can be purchased on the Hive Store.
Rarity: Epic

Can be purchased on the Hive Store.
Rarity: Rare

Can be purchased on the Hive Store.
Rarity: Epic

Can be purchased on the Hive Store.
Rarity: Uncommon

Can be purchased on the Hive Store.
Rarity: Epic

Can be purchased on the Hive Store.
Rarity: Rare
Unlockable Hats
The following hats can currently be unlocked:

Obtained by gifting another player a hat.
Rarity: Uncommon

Awarded for reaching level 10 in Block Party.
Rarity: Uncommon

Awarded for reaching level 18 in Block Party.
Rarity: Rare

Awarded for reaching level 25 in Block Party.
Rarity: Epic

Awarded for reaching level 25 in Gravity.
Rarity: Rare
Unobtainable Hats
The following hats are not currently obtainable:

Obtained by purchasing the Block Friday 2022 bundle.
Rarity: Uncommon

Obtained by purchasing the Block Friday 2022 bundle.
Rarity: Uncommon

Obtained by purchasing the Block Friday 2022 bundle.
Rarity: Epic

Obtained by opening the 12th daily gift during Winterfest 2022.
Rarity: Epic

Obtained by helping Santa during Winterfest 2022.
Rarity: Uncommon

Awarded for completing the Zodiac Banner hunt during Lunar New Year 2023.
Rarity: Epic

Could be found in the hub during the 5th Beeday celebration (October 2023).
Rarity: Rare

Could be obtained on The Hive's 5th birthday (16th October 2023).
Rarity: Rare

Awarded for completing the special 5th Beeday quest (October 2023).
Rarity: Rare

Awarded to players who collected all three of the 5th Beeday party hats (October 2023).
Rarity: Epic

Awarded for completing the Golden Cubee scavenger hunt in the hub.
Rarity: Epic

Awarded for reaching level 20 in Ghost Invasion during Halloween 2023.
Rarity: Epic

Obtained by purchasing the 2023 Block Friday bundle.
Rarity: Rare

Obtained by opening the 12th daily gift during Winterfest 2023.
Rarity: Rare

Obtained by interacting with the InsaneCraft display in the hub.
Rarity: Epic

Awarded to top 100,000 Treasure Wars players (Jan-Sept 2023).
Rarity: Rare

Awarded to top 10,000 Treasure Wars players (Jan-Sept 2023).
Rarity: Epic

Awarded to top 1,000 Treasure Wars players (Jan-Sept 2023).
Rarity: Legendary

Could be unlocked during June 2024.
Rarity: Rare

Awarded for joining on The Hive's 6th birthday (16th October 2024).
Rarity: Rare

Obtained by purchasing the 2024 Block Friday bundle.
Rarity: Rare

Awarded for reaching level 10 in MobGame during December 2024.
Rarity: Rare

Awarded for completing all of the hub picture puzzles during Winterfest 2024.
Rarity: Epic