If your landlord has served you with a lawsuit alleging non-payment of rent, you do have rights. But you need to act quickly to preserve those rights.
Before starting a lawsuit, the landlord must serve you with a rent demand. The rent demand needs to be provided to you at least three days prior to the initiation of the lawsuit. If your landlord sued you without providing a rent demand, that can be a defense in court. If the case is dismissed for failure to give notice, the landlord can still serve you with the demand and start the suit again, but asserting the defense of no notice may buy you some time to raise the funds needed to pay the rent.
Non-payment rent proceedings in New York are heard in Housing Court. You have to answer the petition within five days of receiving it, or you could be evicted from your apartment. The landlord may also be able to get a default judgment against you for the amount of rent allegedly owed. You can go to the Landlord-Tenants Clerk's Office to give your answer orally, or you can serve a written answer on the landlord and file it with the court.
There are often defenses available in non-payment of rent cases. For example, the landlord may owe you money for repairs you made yourself. The landlord may have overcharged you for the rent. The amount of rent the landlord is seeking may be incorrect or illegal.
If your apartment is in need of repairs and the landlord has failed to make those repairs, you may have an abatement defense. Every residential lease has implied warranty of habitability, and if the court decides the landlord has violated that warranty, you may be entitled to withhold rent until the repairs are made.
The information in this post is general information, and should not be taken as legal advice. A New York landlord/tenant lawyer can advise you with respect to your specific situation.
Source: New York State Courts, "New York City Tenants: Questions and Answers About Housing Court," accessed Nov. 10, 2014