Woah. OK, so this is not a recommended best practice. I've had to do it, but it's generally been a night mare.
First - if you can't trust the root, you can't trust the CA chain. The root is the source of the trust, so if there's a reason to not include the root, you have a problem with the basic concept on which PKI is built - that there is a final authority that is so highly trusted that everyone can just believe in it -- and that's the root.
Next - if your case is that you trust some CAs in the hierachy but not others, you have a valid point. For example, in a case that has 2 CAs - one for human certificate issuance and one for non-human (like SSL server certs), it's a fair point that you may want your site to only provide access to one path. That doesn't make the other CA invalid, it just isn't right for the case at hand.
Generally this comes down to the difference between authentication and authorization. If you want only credentials from intermediate CA1, it doesn't mean in this case that credentials from intermediate CA2 are invalid, so they are authenticatable. But they are not authorized for this use case.
In the interest of elegance...
Many trust stores are not built for this use case, but some are. The true answer is that the elegant way is to have additional access control checking code built as a hook to the login use case that does the checking you want to make sure that all users come from CA1 not CA2. It's often considered a specialized use case.
The less elegant way...
I haven't tried this with Open SSL - but you may be able to fake it out - put the intermediate CA you want, AND the root into the trust store. Then make sure all your client requests only include the certificates below that intermediate CA.
The Open SSL code may be able to map it from there. May systems will, particularly when the client is sending a partial chain.
If you can't control the client, you may or may not be out of luck. I don't know of any system that planned for you to explicitly NOT trust the root... it runs counter to the basic premise.