HeelX, what are you trying to do there with the depth?
There has to be some way (maybe vendor specific?) to render the depth into a special depth texture and use it in a shader, as that is what everyone uses for shadow mapping. In newer graphics APIs you can even use such a depth texture as a depth buffer in another rendering pass.
Also, at least somewhen in the past, gamestudio sorted its objects from front to back, to reduce overdraw to a minimum, so even in a worst case scenario, a z prepass might not be as effective as one would expect.
The easiest way for a depth prepass would be, to write a shader just transforming the vertices and the fragment shader setting a single color (with clip or alphatesting, for alphatested textures), the render stage would be set in a way that no color are writte, for example in your shaders technique definition, you could set some flags. And then before rendering again, you just don´t clear the depth buffer.