I really am struggling to understand Spike mechanics. I believe Flying types are immune, Pokémon with an Air-balloon, and Steel and Poison types are immune to Toxic Spikes. What else?
According to Bulbapedia, these are all the different ways to avoid Spikes/Toxic Spikes as of Gen 9.
Spikes:
Toxic Spikes:
Source Source
Hope I could help!