There's a magical location in Drow of the Underdark called Blood of the Spider Queen. If a character fulfills the requirements and performs the activation they get among other things a permanent Sanctuary spell against other Drow. Unfortunately it doesn't go into any detail about how that would actually work.
In case it informs the answer: The requirements are to be a drow follower of Lolth and have at least five cleric levels. The activation is to sacrifice a living, sentient creature at the site. And the value put on this ability for the purposes of calculating wealth by level is 5,000 gp.
Special Ability (Su): A blood of the Spider Queen site grants the recipient a +5 bonus on Bluff, Diplomacy, Gather Information, and Intimidate checks when dealing with other drow. She also gains a recognizable aura of having been chosen by Lolth to lead the dark elves. This latter benefit has no game effect other than to let other drow know that they risk Lolth’s wrath by openly defying the recipient. Finally, a blood of the Spider Queen site grants the recipient the effect of a permanent sanctuary spell against other drow, whether or not they are followers of Lolth. Any dark elf who wants to attack the recipient must make a successful DC 22 Will save to follow through with the attack.
There's several ways I could see this going: It could work on an individual basis or group basis, and a per battle basis or a per turn basis. By that I mean, if the character engages in battle with three enemy drow, it either works for all of them as normal for the sanctuary spell and breaks for all three the moment the character attacks one of them. Or it works for each enemy individually and only breaks for the enemy the character attacks. In both cases it either re-establishes itself on the character's next turn or after the battle is over.
It seems to me this should be treated as an always on magical item. I'm just not exactly sure what happens when an always on magical item turns off. I can't think of any off the top of my head that have a turn off condition. My first thought is it re-establishes itself at the beginning of your next turn. If it operates on a group basis then that's not too powerful I think. You either attack, in which case they all get to attack too, or you don't and they (probably) don't get to either. Repeat every round.