Can a goalkeeper touch with his hands a ball that is outside his box although his feet are inside the box?
No. When determining whether a goalkeeper may touch a ball with
his hands, only the position of the ball matters. If the ball had
not crossed (or touched the plane above) the boundary of the
goalkeeper's own penalty area, it would be considered deliberate
handling, The restart would be a direct free kick at the location
of the handling.
The goalkeeper might be cautioned if the act prevented the
development of a promising goal scoring opportunity in the opinion
of the referee. The goalkeeper might be sent off if the ball would
have entered the net if not for the handling (and without being
touched again by any player) in the referee's opinion.