This paper proposes a novel technique for applying virtual fixtures in a changing environment. The main targeted application is robotic beating heart surgery, which enables the surgeon to operate directly on a beating heart. Using a motion compensation framework, the motion of the heart surface is stabilized in a virtual space, which is presented to the surgeon to operate in. Consequently, the fixture is implemented in this static space, bypassing problems of dynamic fixtures such as position update, placement and force transients. Randomized experiments were performed using a trained surgeon comparing our approach to simple motion compensation and no compensation at all. The positive effect of the fixture in surgical accuracy for a tracking task is also discussed.