In RAML 0.8 you can specify the required attribute for query parameters as you noted, however, as you also noted for different media types that wouldnt be possible to specify required for one and not required for another.
The right way to do it is not specify required, in my opinion, and in your code, if a query parameter is there, use it. If for example you require it for the json and it is not there, return a 400 Bad Request. If it is not required, and is part of the request, and lets say XML could care less, simply ignore the query parameter in your server side code. Also, use the description fields of each media type to document that the query parameter is required or not, optional, etc. It may not be possible to enforce all rules in your particular scenario, but you can go a long way in helping would be consumers of the API understand how to use your resource with different media types and hopefully they are intelligent enough to use it correctly. Of course, you probably want to set up some Postman automated tests (or something similar) to try out all scenarios yourself before you ever release the API to make sure you have all corner cases covered.