There is a vast diversity of bees and wasps out there that all fall under the scientific order of Hymenoptera. Which also includes ants and the less familiar sawflies. Bees are actually one subgroup of the diversity of wasps.
Within this dizzying array of insects, indeed, lots of them can't sting but it's probably not the ones that you think. And among those that can sting, only a tiny minority are responsible for the bulk of stinging human encounters.
Among the bees and wasps that can sting, venom is a unifier. They all have venom, but the compositions are different according to entomologists who studies stingers. When a bee or wasp stings, it's not just the physical poke causing the pain. In fact a 2018 study found no relationship between an insect's stinger size and the pain associated with the sting. They also found an inverse relationship between stinger length and venom toxicity—the shorter the stinger, the more toxic the venom.
Stinging Hymenoptera makes and stores their venom in glands in their abdomens. If you've ever been stung by a honey bee, you may have seen this venom sac left behind with the stinger. When a honey bee loses its stinger, the venom sac stays attached for up to 10 minutes, continuing to pump more venom into a sting site until it dries up. Here's a video that might help you not get stung!
Landing a sting on animals with thick fur or feathers is tough, an entomologist at the Southwest Biological Institute in Tucson, Arizona, who studies stinging Hymenoptera (in part by experiencing their stings firsthand!) and is author of the book "The Sting of the Wild." Getting in as much venom as possible with every sting boosts the chances of a successful defense. In addition, an abandoned honey bee stinger gives off a scent that can help direct other bees to the same vulnerable spot. Schmidt describes the smell as "a cross between fingernail polish and a ripe banana."
Only female Hymenoptera of any species is capable of stinging. That's because stingers are modified ovipositors, the organ used to lay eggs. Instead of stingers, male bees and wasps have their own sex-specific, non-venomous genitalia.
Many bees and wasps also don't have useable stingers to begin with, male or female. There are hundreds of stingless bees, or Meliponini, living in tropical or subtropical areas of the world. Meliponini has significantly reduced stingers that can not be used for defense. They have other tactics to make up for it: they can bite, and they do—hard! Meliponini has powerful mandibles, and their bites pack a punch.