From the Super Mario Wiki
Ads keep the MarioWiki independent and free :)
Super Mario series
Super Mario Galaxy / Super Mario Galaxy 2
Thorny flowers make their debut in Super Mario Galaxy and Super Mario Galaxy 2. They hurt Mario or Luigi when touched, and the only way to destroy them is by attacking them with a Stretch Plant, spinning a coconut into them, or having Yoshi eat them.
There are three types: the standard variant, a larger variant, and a floating variant. The larger variants, after being destroyed by a coconut, will reveal a Sling Star or Launch Star leading to another planet. The floating variants serve as obstacles in various areas, and are more common in certain galaxies, like the Gusty Garden Galaxy, the Yoshi Star Galaxy, and the Tall Trunk Galaxy.
When touched by the Co-Star Luma, thorny flowers will retract their spikes, allowing Mario or Luigi to pass over them safely without needing to destroy them.
Super Mario 3D Land
Thorny flowers later appear in Super Mario 3D Land, being first encountered in World 4-1. As of this game, their thorns are stubbier. They can be destroyed with a projectile (such as Fire Mario's fireballs), as well as by whipping them with Tanooki Mario's tail.
Mario Party series
Mario Party: Island Tour
Mario Party: Star Rush