I do know of a Shul that has posted on part of the building a Notice from the Buildings department Not to enter . Every building in NYC is required to have a C/O (Ceritificate of Occupancy) in order to be used. This shul apparently built in a place they were not allowed and had this sign slapped on a portion of it.
I suppose if you did not know the shul was illegal you could daven there as you would not know it was illeagal, but if the building had this notice from the buildings department Do Not Enter it might be very different