Chastity simply means that the chaste don’t participate in extracurricular sexual relationships. Prudence is okay, but I think it’s a sad commentary that only having your wife with you can you remain chaste.
Every affair begins with a baby step. If you never allow yourself to be in a situation where that first step is a possibility then you avoid the second, third, etc. I would feel loved and cherished if my husband had the same rules for himself. He sort of does, but earlier in our marriage he didn’t. No affairs, but it hurt rather than helped our marriage.
It isn’t only sexual infidelity that hurts a marriage. Just being too close to friend of the opposite sex causes you to give time and affection to that friend that should be given to your spouse.