The ref could get away with saying that he played an advantage for an obvious goal-scoring opportunity, however the scoring player was offside, so technically the handballing defender did not deny a goalscoring opportunity as the ball did go in the net - the offside was not the defenders fault...