Keep in mind an NPC can be AT MOST on one faction. This is the faction that determines how this NPC will respond to you. Will they attack? Will they not attack but not talk to you? Will they give you quests? etc.
Killing an NPC can result in raising/lowering faction with several groups, such as killing Orcs in Crushbone Citadel will lower faction with Crushbone Orcs (naturally) and The Indigo Brotherhood (Dark Elf Warriors) who are their allies. You may or may not be KoS to the Dark Elves and still have an Orc attack you.