Buildings do not offer any additional protection against magic missiles, spells that affect the entire unit, that target individual models, etc. Spells that use templates though will follow the rules given above for templates, hitting D6 models instead.
Wizards inside a building may cast spells as normal following the rules for line of sight and range given for units shooting from a building.