The red number 9 isn't beyond the blue 4 defender but is offside because the goal keeper isn't back. This is one of those rare occasions where goal keeper is out of the goal (e.g. last minute of F.A. Cup final on a corner kick) and can't get back in time but if the attacking team play the ball as they normally would, then it would be offside because the offside rule requires two defenders to be in front the attacker and the goal keeper usually counts as a defender.