If you die to rocky helmet/iron barbs, you don't remove hazards.
Source
This is why. If a Pokemon faints due to Iron Barbs, Rough Skin, Rocky Helmet, etc. and uses Rapid Spin, hazards aren't removed, only the target takes damage.
Bulbapedia says the same thing too:
Rapid Spin inflicts damage and then removes the effects of any binding moves and Leech Seed from the user, as well as entry hazards from the user's side of the field (unless the user has fainted as a result of the move, such as from Rough Skin).
Hope this helps!