  Extended radio sources in the sky require a dense sampling of short baselines
to be properly imaged by interferometers. This problem arises in many areas of
radio astronomy, such as in the study of galaxy clusters, which may host
Mpc-scale diffuse synchrotron sources in the form of radio halos. In clusters
where no radio halos are detected, owing to intrinsic absence of emission or
extrinsic (instrumental and/or observational) effects, it is possible to
determine upper limits. We consider a sample of Planck galaxy clusters from the
Second Data Release of the LOFAR Two Meter Sky Survey (LoTSS-DR2) where no
radio halos are detected. We use this sample to test the capabilities of LOFAR
to recover diffuse extended emission and derive upper limits. Through the
injection technique, we simulate radio halos with various surface brightness
profiles. We then predict the corresponding visibilities and image them along
with the real visibilities. This method allows us to test the fraction of flux
density losses owing to inadequate uv-coverage and obtain thresholds at which
the mock emission becomes undetectable by visual inspection. The dense
uv-coverage of LOFAR at short spacings allows to recover $\gtrsim90\%$ of the
flux density of targets with sizes up to $\sim 15'$. We find a relation that
provides upper limits based on the image noise and extent (in terms of number
of beams) of the mock halo. This relation can be safely adopted to obtain upper
limits without injecting when artifacts introduced by the subtraction of the
discrete sources are negligible in the central region of the cluster.
Otherwise, the injection process and visual inspection of the images are
necessary to determine more reliable limits. Through these methods, we obtain
upper limits for 75 clusters to be exploited in ongoing statistical studies.
