Nature has gifted every life form on earth with some or other kind of defense mechanisms or tools to protect themselves from various dangers. Plants too are equipped with amazing defensive weapons to prevent from being eaten or invaded by disease causing microbes. Many plants are capable of poisoning their predators and such plants are often unpleasant to taste. So a bad taste indicates a danger signal to animals trying to eat them. There are exceptions like insects (especially caterpillars of monarch butterflies and milkweed tussock moths) thrive on a diet of poisonous milkweed leaves.
The very common but not quite powerful weapon that few plants have in order to avoid being eaten by animals is the thorn. Thorns come in various shapes and sizes. It could be found in any part of a plant. For example, the thorns in the rose plant are actually called prickles that extend from the outer skin of the stem. These prickles attached to the surface could be easily broken. There are hard ones too attached to the woody structure of the trees like hawthorn, honey locust etc.
There are plants that have hairs whose touch cause irritation in the skin. For example, there is a nettle plant whose hair is stiff and hollow like a needle which is capable of injecting poisonous fluid into the predator.
Micro organisms like fungi, bacteria and viruses could cause plant diseases if they gain an entry into the plant say through a cut. To prevent this, many plants contain soap like compounds called saponins. When their cells are invaded by microbes, the saponins attack the microbes and kill them.