There are defenses
If the threat is kinetic, you move. If it has guidance you shoot it down or use EWS.
If the threat is radiant (and moving at a good percent of the speed of light), you have to prepare in advance by squirting an absorptive substance (like sand) in its path. Depending on the nature of the beam various forms of reflective and/or ablative armor can help.
