I find that using depth of field (DOF) distorts the render pass masks, especially for very out of focus objects with a low f-stop (large aperture). I am trying to get around this by making a separate render layer with no DOF which I will only use for pass index masks. But I have not found a way to use no DOF on a specific render layer. So is it possible to tell blender to not use any DOF in a specific render layer, either directly or by using a different camera?
You can use multiple scenes:
Add a new scene by pressing the + at the top of the screen and selecting Link Objects:
This will link the objects into a new scene. This way modifying any object will change it in both scenes.
In the new scene, select the camera and unlink it from the first scene by pressing U> Object Data. Then set the camera's aperture size to 0 to disable DoF. Note that the aperture must be set to radius for this to work.
Then you can get the render results of both scenes in the compositor by using multiple renderlayer nodes:
Note that each scene has it's own compositing node tree, so it might be confusing if you have composite nodes in both scenes. I usually like to keep all the composite nodes in one scene.
If you add any new objects to one scene, they can be linked to the other scene by selecting them and pressing ⎈ CtrlL> Link objects to scene and then selecting the scene you want to link to.