We numerically investigate turbulent Rayleigh–Bénard convection with gas bubbles attached to the hot plate, mimicking a core feature in electrolysis, catalysis or boiling. The existence of bubbles on the plate reduces the global heat transfer due to the much lower thermal conductivity of gases as compared with liquids and changes the structure of the boundary layers. The numerical simulations are performed in three dimensions at Prandtl number $\mbox{Pr}=4.38$ (water) and Rayleigh number $10^7\leqslant \mbox{Ra}\leqslant 10^8$. For simplicity, we assume the bubbles to be equally sized and having pinned contact lines. We vary the total gas-covered area fraction $0.18 \leqslant S_0 \leqslant 0.62$, the relative bubble height $0.02\leqslant h/H \leqslant 0.05$ (where $H$ is the height of the Rayleigh–Bénard cell), the bubble number $40 \leqslant n \leqslant 144$ and their spatial distribution. In all cases, asymmetric temperature profiles are observed, which we quantitatively explain based on the heat flux conservation at each horizontal section. We further propose the idea of using an equivalent single-phase set-up to mimic the system with attached bubbles. Based on this equivalence, we can calculate the heat transfer. Without introducing any free parameter, the predictions for the Nusselt number, the upper and lower thermal boundary layer thicknesses and the mean centre temperature agree well with the numerical results. Finally, our predictions also work for the cases with much larger $\mbox{Pr}$ (e.g. $400$), which indicates that our results can also be applied to predict the mass transfer in water electrolysis with bubbles attached to the electrode surface or in catalysis.