Reference Implementation for TestNG: To Exclude test when there is bug ID mapping to a test and mapped bug Id is in Open statu.
Please visit my blog post for detailed explanation - http://allselenium.info/test-automation-reduce-time-to-analyze-and-report-failures/