So, assuming an NPC knows the party at all, knowing that one of them was an elf would instantly allow you to know that the elf is immune to magical sleep with a DC whatever knowledge local.
It's not really metagaming after that point to think hey, I want to knock this fool out and I can't use magic. Guess I'll poison/drug him.