The fluid–structure interaction of resonating microcantilevers immersed in fluid has been widely studied and is a cornerstone in nanomechanical sensor development. In many applications, fluid damping imposes severe limitations by strongly degrading the signal-to-noise ratio of measurements. Recently, Burg et al. (Nature, vol. 446, 2007, pp. 1066–1069) proposed an alternative type of microcantilever device whereby a microfluidic channel was embedded inside the cantilever with vacuum outside. Remarkably, it was observed that energy dissipation in these systems was almost identical when air or liquid was passed through the channel and was 4 orders of magnitude lower than that in conventional microcantilever systems. Here, we study the fluid dynamics of these devices and present a rigorous theoretical model corroborated by experimental measurements to explain these observations. In so doing, we elucidate the dominant physical mechanisms giving rise to the unique features of these devices. Significantly, it is found that energy dissipation is not a monotonic function of fluid viscosity, but exhibits oscillatory behaviour, as fluid viscosity is increased/decreased. In the regime of low viscosity, inertia dominates the fluid motion inside the cantilever, resulting in thin viscous boundary layers – this leads to an increase in energy dissipation with increasing viscosity. In the high-viscosity regime, the boundary layers on all surfaces merge, leading to a decrease in dissipation with increasing viscosity. Effects of fluid compressibility also become significant in this latter regime and lead to rich flow behaviour. A direct consequence of these findings is that miniaturization does not necessarily result in degradation in the quality factor, which may indeed be enhanced. This highly desirable feature is unprecedented in current nanomechanical devices and permits direct miniaturization to enhance sensitivity to environmental changes, such as mass variations, in liquid.