I just had a similar problem myself since I wanted to create a "System temporarily down due to maintenance"-page that would disable my site entirely in prod-environment only as I use dev-environment to make sure everything is alright after deploying an update to my production server. I guess its debatable whether this is good practice, but anyway...
The comment made by Leto to a previous answer gave me an idea how to solve it and I think I have successfully managed to make my route only work in dev-environment like so:
default_update_view:
path: /{route}
defaults: { _controller: WalanderBundle:Default:maintenanceInfo }
condition: "request.getScriptName() == '/app.php'"
requirements:
route: .+
No the question was to only enable a route in dev-environment which would then be done by changing the condition as follows if I'm not missing anything obvious:
condition: "request.getScriptName() == '/app_dev.php'"
Hope this helps although the question was a bit old!
Perhaps in the case when you want to enable a route in the dev-environment only the already provided answer by JonaPkr is best practice though.