Yes, a gentleman should always remove his hat when indoors, including when meeting the Royal Family, as it is a sign of respect. Women are generally allowed to keep their hats on, especially formal ones, unless they are large and would block the view of others or if the hat is not part of a religious head covering