Ok, I think I got you now. Unfortunately, I don’t know haw to do this with Osmosis. Maybe anyone else could help?

Why do you want to exclude these ways completely? Wouldn’t it be better to accept the ways and remove every node of them which lies outside the bounding box?