New York does not have a law permitting you to withhold rent. It appears that you're in NYC, so read this.

If your lease says you are renting a three bedroom apartment, and in fact there are only two legal bedrooms, you can explore the possibility that you can get out of your lease on that basis. What does the lease say about the number of bedrooms?

Failure to register a property with the HPD subjects a landlord to a potential fine, and creates a potential defense to an action to evict you for nonpayment of rent. (The details matter.)