The motion court may consider an affirmative defense that was not pleaded in the answer where the facts leading up to the accident are known to the plaintiff based on deposition testimony and materials exchanged during discovery.
Santana v. Metropolitan Transp. Co., NY Slip Op 02158 (1st Dep't March 19, 2019)
Here is the decision.