Only the first is a possible English sentence. There are three events described here: ‘typing for three hours’, ‘typed the wrong documents’ and ‘he realised’. The first two happened at roughly the same time, and are therefore written with a past perfect construction. The first uses ‘had been’ + the –ing form of ‘type’ to show progressive aspect, because the typing is seen as continuing over a period of time. The second uses ‘had’ + the past participle of ‘type’ to show perfective aspect, because typing the wrong documents is seen as a complete event. The third event is expressed in the past tense, ‘he realised’, because it is seen as a complete event that occurred at a specific time in the past, but after the other two events.
In the second sentence, ‘he typed the wrong documents’ doesn’t work because the use of the past tense there places the event in the same time frame as ‘he realized’, which clearly happened after the typing, not at the same time as the typing.
The third sentence is almost possible, but there the past tense, ‘typed’, also gets the timing wrong. Typing the wrong documents happened before the realization of what had happened, and so needs a construction that expresses that prior occurrence. What is called for, therefore, is ‘he had typed the wrong documents.’
It looks as if something has been left out from this sentence, the meaning isn't clear as it is. It would look natural like this:
When we entered, we realised he had already been there.(Meaning: he went there and left before we did.)
I suppose it is the choice of the verbs used in the initial sentence that doesn't make the meaning clear. If you want to express that he was there before we went to the particular place, then you should say "When we entered he had already arrived" or "When we entered he was already there."
Best Answer
Had/has/have been is usually used for something that was done in the past and still applies (multiple events).
Was/were usually applies to something done in the past that no longer applies (single event).
Example:
The first sentence implies that the well still is producing water, but it's no longer clean for some reason.
The second sentence implies that the well is no longer producing water.
Of course, context is very important. Here's another example:
The first sentence implies that 'I' had, at some point of time, run. It could have been earlier in the day, or even the night before.
The second sentence implies that 'I' have just finished running a little while ago.
As you can see, context is heavily implicated. How long is a while?
Consider:
The two now emphasize two different things. The first implies that perhaps 'I' originally ran for health benefits, but continue to do so for other reasons. The second implies that at one point they ran to get healthier, but a strong implication that they have stopped.