In Zoo Tycoon 2 you have two options for dealing with the mess animals leave behind, and one of them is unexpectedly hands-on.
The conventional approach is to hire or assign a zookeeper. Keepers clean enclosures as part of their routine, so a well-staffed zoo stays tidy without any intervention from you. If your habitats are consistently dirty, the real problem is usually staffing rather than the mess itself.
You can also do it personally. Switch into zoo guest mode and walk up to the offending item. When you are close enough, the game prompts you to press the space bar, and your guest does the honours.
So the short answer to the question is the space bar.
Keeper-led cleaning is what you want for normal play, since it scales with the size of your zoo. The guest method is more of a novelty, and it is a reasonable way to tidy a specific enclosure quickly without hiring anyone.