Honey's bacteria resistance properties aren't completely understood, but it is known that there are antimicrobial enzymes in certain types of honey as well as hydrogen peroxide (which can kill bacteria and viruses). There is also evidence that honey may inhibit quorem sensing, which is a mechanism by which bacteria can coordinate certain behaviors.
Furthermore, honey has a very high osmolarity -- it's is formed when bees bring sugar-rich nectar to a honeycomb, in which it is then dehydrated until it is less than 20% water. This can make it difficult for bacteria, which may rely on a certain level of water content in the environment, to survive.
An additional factor is the pH of honey, which is acidic and may also prevent bacterial growth. Though you would never notice it from the taste.
- Honey has a higher sugar to water ratio than the inside of bacteria so the water in bacteria will leak out through the cell wall thus drying out the bacteria.
- Honey generate H2O2 when diluted, and hydrogen peroxide (H202) is a bleaching agent
- Honey is acidic enough to inhibit some bacterial growth
- Some honey has antibacterial properties that aren't due to H202, compounds like methylglyoxal found in manuka honey contribute to its antibacterial properties but aren't the only source.
It also has an low water content, this, along with it's high acidity, makes it inhospitable to bacteria.