Basic xG models use only shot location (distance and angle from goal) to estimate conversion probability. More accurate models incorporate the positions of defenders and the goalkeeper at the moment of the shot. A shot from the penalty spot with two defenders blocking the shooting lane has far lower xG than one with a clear path. Similarly, a GK who is off their line or poorly positioned changes the probability meaningfully. Defender-context xG is the standard for serious analytical work.
Correct modeling: at the moment each shot is recorded, capture the x,y coordinates of all defenders and the GK within the shot cone. Features to add to the base xG model: number of defenders in the shot cone (within ±15 degrees of the goal line), GK distance from goal line, GK lateral offset from optimal position. These features materially shift xG for shots in central box positions — a "high-probability" shot becomes low-probability when the shot cone is blocked. StatsBomb's data provides GK and defender locations on every shot as a data field.