There's Only One Correct Way To Store Cocoa Powder
If you have any recollection of what a cocoa powder can looked like in the late 80s and early 90s, you could probably take a good guess at how it needs to be stored. The top was made of metal with a circle opening. To remove the lid, you had to use two fingers simultaneously to pry it open. Apply too much pressure to one side and the opposite side would close further. If the lid had even the slightest tilt to it, it was done. Never opening. Get a new can.
Cocoa powder insists on being stored in an airtight container, and we don't blame it. Once sealed tightly, always store in a cool, dry place like a pantry or baking cabinet. The refrigerator and freezer are far too humid for cocoa powder. It naturally absorbs moisture so cool and dry are very important. Cocoa producers have since evolved from the metal lid to a more user-friendly plastic fitted top with a foil peel back underneath. Always make sure this lid is closed well.
Can it go bad?
The simple answer is: Yes, cocoa powder can go bad if not stored correctly. Unopened, it can last 2 to 3 years. Once opened, 1 to 2 years. The signs of spoilage are not as easy to detect as what you would typically see in common perishable items. First, always check the expiration and/or "best by" dates printed on the can. This is the easiest way to know if your cocoa is within the fresh date.
Next, there are three signs to watch for to see if it has gone bad — appearance, aroma and taste. For appearance, simply take a good look at your cocoa powder. If you see any signs of mold or discoloration, toss it. When checking the aroma, take a good sniff (making sure not to get any inside your nose) and see if there are any signs of a sour or foul smell. If so, it is no longer good. For taste, cocoa powder has a naturally bitter flavor so for this you're checking for a moldy or funky flavor. Throw it out if you discover any of the above elements and replace it with a brand new can.
Aside from storage, there are a couple of other tips to help protect your cocoa powder from spoiling. Always use a clean spoon when dipping into the container. This helps to prevent contamination. And, if you're using minute amounts often, like for adding to your coffee each day, put a smaller amount of cocoa in an airtight storage container and use the original can only for refilling. This exposes the majority of the cocoa to less air and light.