Yes, insurance companies must select their risks according to objective technical criteria, to guarantee the service and benefits promised to all policyholders and, in short, to ensure their continuity as a company.
If an insurance company considers that insuring something poses a risk to its solvency and to the protection of its policyholders, it may refuse to insure it.
The insurer may refuse to insure a homeowners' association in a very old building because of the intrinsic risk it represents or, for example, if it has an extensive history of water damage.