Fungal and bacterial infections are spread mainly by spores, facilitated by moisture on the leaves or in the soil. Keeping infections out is impossible, especially when spores are spread by wind, but you can minimize their effect for example, by promptly removing leaves and stems attacked by powdery mildew before it puffs out more spores. If you're growing roses, choose disease-resistant varieties. Where conditions are such that a rose regularly gets black spot, either grow something else (in severe cases) or spray it with an appropriate fungicide every week or two from early spring onward as a prevention. When spraying, always wear gloves or wash your hands thoroughly afterward. Sterilize pruners after using them on diseased plants.