We study the decay rate for the energy of solutions of a damped wave equation in a situation where the Geometric Control Condition is violated. We assume that the set of undamped trajectories is a flat torus of positive codimension and that the metric is locally flat around this set. We further assume that the damping function enjoys locally a prescribed homogeneity near the undamped set in traversal directions. We prove a sharp decay estimate at a polynomial rate that depends on the homogeneity of the damping function. Our method relies on a refined microlocal analysis linked to a second microlocalization procedure to cut the phase space into tiny regions respecting the uncertainty principle but way too small to enter a standard semi-classical analysis localization. Using a multiplier method, we obtain the energy estimates in each region and we then patch the microlocal estimates together.