There is no scientific evidence to back this up as a
prevention method, but it stands to reason that it could wash the virus off your skin if it hasn't penetrated to the nerve endings.
Keep your immune system strong. Sleep, good food, avoid stress, maybe also take vitamins or supplements. Sometimes your body can fight off herpes.
Even if you do all this, please understand, you can still get herpes. It's a very virulent little sucker of a virus.