It depends on which one you mean. If you're talking about the earth spirits on Nabooti Island, you get the plant and take it to the lady in the market. She'll give you a ninja hat, and then you click on one of the ninjas to proceed.
If instead you mean Spy Island, the answer given is that they weren't sure how to defeat those ninjas. So for Nabooti, the plant-and-hat method is your solution, while Spy Island may need a bit more digging.