I am currently working on a real-time reporting for Fastpath. I forward all messages to a Node.JS application that parses the stanzas. In the case of rejected chats, you need to look for an iq packet with a child named "offer-reject", as follows:
<iq to='support@workgroup.example.com'from='alice@example.com/work' id='id1' type='set'>
<offer-reject jid='user@example.net/home' xmlns='http://jabber.org/protocol/workgroup'/>
</iq>
In this example, 'support' is the workgroup name, alice is the agent, and user is the Jid for the user who made the chat request. The underlying XMPP extension that this is documented in is XEP-0142 - Workgroup Queues and is documented at: http://xmpp.org/extensions/xep-0142.html.
In my case, I created a plugin to direct stanzas to a Node.JS application. Another approach would be to create a plugin to intercept and process the stanzas.