First of all you really need to follow your solicitors advice.
In fairness though the estate agent may be telling the truth. In some town halls it is possible to get a licence of second occuapancy if the place has been occupied for a period determined by the town hall (usually between 3 – 7 years) BUT this is a very shaky road to go down and NOT worth the potential aggravation.(You may be lucky – you probably wnt)
If it doesnt have all the legal dcumentation then leave it alone. There are many houses around and for sure you will find something that is legal.