The one case where grounding is prohibited that I know of are so-called SELV circuits. These use double/reinforced insulation from mains so that they cannot reasonably become shorted to mains themselves and additionally they aren't earthed, so that they cannot become a ground return path for some unfortunate user who ends up touching a SELV circuit and some other, high voltage circuit at the same time.
SELV is supposedly required in some circumstances. No idea where and when.
A grounded boiler certainly isn't SELV itself, because it's grounded
However, if the logic board has some connections to the external world, it is theoretically possible that some users would want to plug it into SELV circuits. In such case, your device should not provide ground connection to the logic board, even if the whole chassis is grounded, because that would compromise the external SELV circuit.
I have seen one high power machine in earthed metal chassis, whose control board was internally isolated from earth and all earth-referenced electronics and it was advertised as compatible with SELV circuits. If somebody pays you for SELV compatibility, grounding is out of question. But you would probably already know, and your boiler likely doesn't have any electronic interfaces in the first place.
Other than that, most devices you own at home with three prong plugs have all their digital boards grounded to Earth. And they work fine and still haven't killed you if you are reading this
All of the above assumes that the boiler is grounded to protective earth. If it's grounded to neutral, that's a horrible thing in itself and you really shouldn't be doing it. And it will be banned it most of the world the moment anyone finds out.
Also, another thing about using mains voltage to sense that sensor: I'm no expert on regulations, but I wonder if it is even legal to do so? Shouldn't all current from mains be returned to neutral rather than PE?