Here's an example of how it might play out: the adventurers are in a typical dungeon and discover a small tunnel that only the party's halfling can fit in, so the halfling volunteers to check it out. When the halfling emerges from the other end, the GM calls for a surprise roll, which the halfling loses, and then calls for a save, which the halfling fails. This represents the doppelganger knocking the halfling unconscious before any warning shout is possible. The doppelganger then automatically kills the unconscious victim (coup de grace,) but the GM doesn't inform the player of this, but makes up some excuse for the save ("The floor of the room you enter gives way and you fall into a pit, but fortunately you are uninjured.") Play then proceeds as normal, with the halfling's player unaware that the halfling is dead.
When the "halfling" is revealed to be a doppelganger who has killed the real character, though, there's a huge chance that the player will feel hosed. That saving throw was basically a save or die situation. If the doppelganger is revealed and somehow prevented from causing further harm without actually killing it, the GM can offer some consolation to the player by letting them play the doppelganger; they keep their current equipment and treasure, gain shapeshift and ESP abilities, and can even be allowed to reroll all ability scores and keep the higher of each pair. There's still a chance the player will feel disgruntled.
Let's suppose instead that the halfling's player isn't surprised or doesn't fail the save, which would give the halfling an opportunity to shout a warning. In this case, the GM describes the attack: "You crawl through the tunnel and emerge into a dark chamber, where you are immediately attacked by your exact duplicate!" The question here is: do you play out the combat, or do you just say, "You kill the creature that looks like you" and move on? The advantage to the second approach is you get the tiny bit of suspicion from the players, which seems like what would naturally happen if one member of a party of adventurers gets separated, shouts out, "I'm being attacked by my duplicate!" then rejoins the party and says, "I killed my duplicate. Man, what was that about?" You could keep the issue a mystery up until the moment the players find a method to reveal the truth, then do a flash-back and play out the rest of the combat.
If the flash-back is short, it's not too bad. But if the character is alive and not unconscious, and if the players take a long time to resolve the mystery, you have a problem. For example, let's go with the original halfling vs. doppleganger scenario, with the doppelganger knocking out the halfling, but with the GM deciding to fix the "hosing" problem by skipping the coup de grace. The real halfling remains in the inaccessible room, unconscious, while the fake halfling returns and says, "nothing in there." Play continues for a while, then the party figures out the duplicity and deals with the doppelganger. Now, though, you'd have to play out what the halfling did after waking up and discovering the others are missing. Not only does this mean that the other players have nothing to do while the halfling essentially has a solo adventure, but also there's a chance of paradox: the halfling reaches an area the party also explored, about the time that the party should have been present, but since we already played out that encounter, we know that the real halfling wasn't there.
We can perhaps fix this by assuming the halfling can't regain consciousness without first aid of some kind, but in the case of long separations, this may be a problem; presumably, the halfling will die of thirst after three days, or die of hunger in a couple weeks. It's probably simpler to avoid this kind of character replacement and re-think the way the doppelganger works.