Besides, the appraiser will not include that unit in the value of the building when doing the appraisal for your purchase loan. Same thing when you eventually sell - you can't claim that the unit even exists for valuation purposes, plus many potential buyers will see the same risks I'm describing and pass on making a bid on the property, thereby potentially driving down the value.
I'm not saying pass on buying the building, but I am saying that if you are able to buy it, budget for getting the un-permitted features permitted and inspected and adjust your offering price accordingly.
I've seen many properties sold with illegal units, the only thing is that the appraiser can not take into account the additional unit when appraising. Of course, there is always the risk of the city finding out and doing something about it, but it's very rare. This is from my experience of being in the real estate business for over 20 years, please do not take this as legal advise.