Ok, I'll take a shot at this one.
The text for Effect from SRD 3.5: "Effect: Some spells create or summon things rather than affecting things that are already present. You must designate the location where these things are to appear, either by seeing it or defining it. Range determines how far away an effect can appear, but if the effect is mobile it can move regardless of the spell’s range."
The text for Range from SRD 3.5: "RANGE / A spell’s range indicates how far from you it can reach, as defined in the Range entry of the spell description. A spell’s range is the maximum distance from you that the spell’s effect can occur, as well as the maximum distance at which you can designate the spell’s point of origin."
Some of the text for Summon Monster I from 3.5 SRD: "This spell summons an extraplanar creature (typically an outsider, elemental, or magical beast native to another plane). It appears where you designate and acts immediately, on your turn. It attacks your opponents to the best of its ability. If you can communicate with the creature, you can direct it not to attack, to attack particular enemies, or to perform other actions."
Also from Summon Monster I from SRD 3.5: "Effect: One summoned creature" and "Range: Close (25 ft. + 5 ft./2 levels)"
So, my understanding is that the caster can designate any point within Close range for the creature to appear, by *defining* it (as in the spell text). For example, the definition might be "10 feet past this door". The spell automatically knows who your "opponents" are, simply because this is the only way it's playable. Just like the Bless spell automatically knows who your "allies" are. If you can speak the creature's language, and it can hear you through the door, then you can give it another command.
As a side note, the only risk I see for the player is that creatures on the other side of the door, which the *character* would not consider an "opponent", might attack the strange creature which suddenly appears in their midst, even though the creature doesn't attack them. In this case, of course the creature would attack back, again, simply because it's the only way to play it.
Hope that helps.