Limited material transport, causing gas cavities formation, is commonly observed during the degradation of magnesium implants, yet its effects on corrosion are not understood. Herein, a bespoke cell was designed, allowing for the incorporation of an additional agarose layer above the corroding magnesium sample. This design replicates the limited material transport in vitro and enables us to understand its influence on corrosion of magnesium alloys. This work investigated the influence of varying thickness of agarose (0-0.9 mm) on the corrosion of Mg-Zn-Zr magnesium alloy maintained at 37 C in phosphate-buffered saline (PBS). The introduction of agarose slowed transport of material away from the corroding magnesium surface, including the evolved hydrogen forming a gas cavity. It has been found that an initial increase in the agarose thickness (or the reduction in material transport) of 0.3 mm leads to an increase in the corrosion rate of the magnesium alloy by 62%. However, with a further increase in agarose thickness from 0.3 to 0.9 mm, the corrosion rate decreases by 37%. This observation has been attributed to the accumulation of, and competition between, chloride and hydroxide ions near the alloy's surface. In the presence of materials barrier, hydrogen measurement is no longer a reliable method for the measurement of corrosion rates. This study underscores the importance of the consideration of limited material transport during the in vitro corrosion tests of biomedical implants.