I have always wondered this.
Is a goalkeeper handball determined by where the ball actually is, or where the goalkeepers body is positioned at the point of contact?
In football, the ball is the one that determined the position in the field.
So if the goalkeeper handles the ball outside of the box, it's considered a foul (handball) by the goalkeeper and a free kick should be granted to the other team.
Also, all of the body of the goalkeeper could be outside the box, but if the ball and his hands are inside, there is no foul.
This also is taken into account when granting a goal. The whole ball has to pass the goal line, and any player inside the box or even inside the goal line can try to prevent it, no matter where his body is.