Hmm, lets assume you have a var containing the rectangle alpha (for example):
local rcAlpha = 255;
function drawMyRec()
dxDrawRectangle( x, x, x, x, tocolor( 0, 0, 0, rcAlpha ), false ) --replace 'x' with your screen coordinates
end
addEventHandler( "onClientRender", root, drawMyRec )
So when you need to hide it, you just set rcAlpha to zero, or you just do
removeEventHandler( "onClientRender", root, drawMyRec )
to entirely stop the drawing of your rectangle.
As you can see, there are different ways of doing what you want (if I understood correctly what you want, ofcourse...)