You may withhold rent from a landlord if they fail to provide you with a livable and safe environment. However, this does not mean that you can stop paying rent because you do not like the color of the walls or the carpet. The landlord is responsible for ensuring the fabric of the building is intact. They must also ensure that all major utility services, such as plumbing, electricity, and heating systems, are safe and in good working order.
You should only resort to withholding rent in severe cases. However, if you have made the landlord aware of a problem and they fail to respond to your requests or refuse to undertake the repairs, you could handle the issue and deduct the money you spent from the rent. This is called “repair and deduct” and is legal per New York City state law. However, before repairing and deducting, ensure that you have given your landlord time to fix the issue.