What I would do is to wait and see if they start to take their shoes off - if they do, there won't be a problem and you won't have to ask. If they don't start to take their shoes off, you should just ask.
When I go to someone's house, I do as they do.
-If they are clearly shoes off, I take them off
-If they are clearly shoes on, I keep them on (provided not muddy/wet)
-If I am unsure, I ask - do you want me to take my shoes off and comply with the answer
The last few people's houses I have been to are shoes off houses. I think it is on the increase - not sure whether the majority are shoes on or shoes off.
Personally, we have shoes off. We don't usually ask, people just see that we don't wear shoes inside. When we had DS and DD christened, we had about 12 guests back to our house. All voluntarily removed their shoes apart from my dad and his wife. He does it to annoy me I think - when DD was only a few weeks old (having been born a little early), he trampled on her playmat in his shoes!! He nearly snapped a plastic bit on it and I thought it was really bad behaviour (he is not elderly or anything like that in case you think I am being mean!). My brother and his gf have just got their own flat and they have cream carpets - my dad trampled them and marked them by wearing shoes deliberately when my brother was out!!
Those of you who inwardly seethe when removing shoes (having been asked or having to do so because it is obvious), how do you feel about your host inwardly seething when you don't remove your shoes?
And some of us have light carpets in places because the rooms are small/there isn't much light and it is just to make the rooms less cave like. Not because we want cream carpets to be precious.