Annihilate is a spell that says, in part: "Destroy target nonblack creature". There are many ways to keep Annihilate from working. For example:
A creature that can't be the target of Annihilate (e.g., because it has shroud or protection from black) can't be targeted or destroyed by that spell (C.R. 115.1a, 608.2b, 702.18a, 702.16b). Neither can that spell target black creatures (C.R. 115.1a).
Also, Annihilate can be countered or otherwise removed from the stack to keep it from working (C.R. 701.5a; under C.R. 116.4 and 608.1, for a spell to resolve, all players must pass in a row while it's on top of the stack). Notably, if Annihilate's target is illegal when it would resolve, it fails to resolve (and no card is drawn) (C.R. 608.2b).
Assuming you mean annihilator the ability on some eldrazi, there are ways. There are several creatures such as Sigarda, Host of Herons or Tajuru Preserver. Effects like these stop annihilator from effecting you.
Yasharn, Implacable Earth as well but I'm unsure if it stops the annihilator trigger or not since while annihilator is only when you attack but I'm unsure if that counts fully as a triggered ability.
Yasharn doesn't help in this situation. It stops people from saccing to activate an ability (or cast a spell), but it doesn't stop a triggered ability from forcing sacrifice. So, it would prevent casting Fling or activating the ability on Attrition, but Annihilator still hurts. As far as I know, Sigarda, Host of Herons and Tajuru Preserver are the only ones that do that, and they were already mentioned.