The best way to deal with it, if you have not had the chance to let your host know ahead of time, is to discreetly ask the wait staff if they could bring you another plate without the offending item.
Most restaurants and places that host large dining events have something they could substitute for the item you can't eat.
Even asking for a plate of vegetables or a larger salad would be appropriate.
Most importantly, don't draw too much attention to yourself.
If asked by someone at the table, just quietly say you can't eat that particular item. To do otherwise and make a big deal out of it can cause some embarrassment for the host.
To avoid this from happening, it is important for the host to ask if people have any dietary restrictions or preferences and be prepared to offer something else in place of what the rest of the guests are eating.
If you are the person with allergies or restrictions, let your host know ahead of time, if possible. It will save some angst for everyone.
Just saying, “By the way, I am allergic to seafood,” or “I am a vegetarian” is a polite way to alert your host when an invitation is issued.
If you are the restaurant or facility that hosts large events, have a plan in place for emergency dining situations.