You can't stop it before it happens; only after.
If someone else claimed your exemption (dependency) inappropriately, and if they file first, your return will be rejected if e-filed. You would then need to file a return on paper, claiming the exemption if appropriate. The IRS will process your return and send you your refund, in the normal time. Shortly (up to a year) thereafter, you’ll receive a letter from the IRS, stating that your exemption was claimed on another return. It will tell you that if you made a mistake to file an amended return and if you didn't make a mistake to do nothing. The other party will get the same letter you did. If one of you doesn't file an amended return, unclaiming the exemption, the next letter, from the IRS, will require you to provide proof. Be sure to reply in a timely manner.
Winner gets the tax benefits; loser gets to pay the IRS back with penalties and interest.