When I was learning karate, the instructor taught me on day one that karate is a form of self defence we should use it to protect ourself from the bad actions. Today, taking those learnings let me put you forward a more brainy concept of self defence against negative energies.
There is nothing negative in it as it sounds it is just those energies which you do not want to attract and if it crosses your path it would demand more time and stress. A good example would be argument over politics with your friend. Investing time in negative energy would deviate you away from your long term happiness even if you are able to win such by proving your energy / thinking as the righteous. So the best way to prevent these energies from draining you is to learn the art of self defence against them by not allowing to pass through you.