I have this problem all the time! My younger sister has a dairy allergy and i have a gluten problem.
I usually ask if they know what's in it, if I can see an ingredients list, something along those lines. And I ALWAYS bring a few cookies or treats for myself that I know are "safe foods". If they dont' know or can't give you a list of whats in the food, I say sorry, but I cant eat it.
Its hard, though. There's always that part of me that thinks, "Could I get away with this one piece of cake...?" haha
While the usual etiquette is to try a little of something whenever a hostess offers something, in the case of allergies, it is alright to politely refuse. But, don't just politely refuse something. Politely explain that you have allergies and you can't eat certain things. If you know ahead of time, try to inform the hostess ahead of time. And, it definitely helps for you to bring along some items that you can eat. Offer to bring a dish you can share with everyone. For gluten free at a gathering, suggest to the hostess a separate table for just gluten free items. Also, make sure everyone understands that they can't use the same serving utensils for everything. Each item must have its own serving utensil that cannot be exchanged with other items on the table. Try to talk about such things with the hostess before setting out. You can also offer to help the hostess, so that you can ensure that everything is separated as necessary.
I ask and read read read labels. Most of the time, I won't eat things if I have any doubt.
I am still getting there , and yes I read the labels if I have remembered my magnifying glass ........