In the Euro 2012 match between Spain and Ireland, the referee actually ended up tackling down a player who was receiving the ball from his defense and moving off to dribble through the incoming players, resulting in a situation where Spain had a great chance of scoring based on this mistake by the referee. Involuntary it may be, but he had a direct effect on the game, unlike the ball hitting him on its course, or a player running in to him.
In the situation you describe, that being the referee impeding a player, the referee has no obligation to stop play or provide compensation to either the attacking or defending team.
Law 9 of the FIFA Laws of the Game state:
Ball Out of Play
The ball is out of play when:
it has wholly crossed the goal line or touch line whether on the ground or
in the air
play has been stopped by the referee
Ball In Play
The ball is in play at all other times, including when:
it rebounds off a goalpost, crossbar or corner flagpost and remains in the
field of play
it rebounds off either the referee
So, there is nothing that states explicitly that the ball is out of play in the event of a collision.
Now, if we look at the interpretation of the rule, we have the bullet above which states “play has been stopped by the referee”. So we ask, should the referee stop play?
The answer is “No”. The referee is deemed as part of the field of play. A player colliding with the referee is, for all intents and purposes, the same as a player colliding with the post, tripping over on the grass or catching his foot on the corner flag.
One exception to this would be if the player was substantially injured (such as a head injury). The referee would then use his discretion to stop the play if desired.
In summary, the referee will do his best to keep out of the way of the ball and players but, if he does collide with the ball or a player, play shall continue.