Usually service can be removed using API calls, but if the service is inconsistent state then API's does not work.
so only way to delete is by running SQL queries. here is the list of steps to delete KNOX service.
1. delete from serviceconfigmapping where service_config_id in (select service_config_id from serviceconfig where service_name like '%KNOX%')
2. delete from confgroupclusterconfigmapping where config_type like '%knox%'
3. delete from clusterconfig where type_name like '%knox%'
4. delete from clusterconfigmapping where type_name like '%knox%'
5. delete from serviceconfig where service_name = 'KNOX'
6. delete from servicedesiredstate where service_name = 'KNOX'
7. delete from hostcomponentdesiredstate where service_name = 'KNOX'
8. delete from hostcomponentstate where service_name = 'KNOX'
9.delete from servicecomponentdesiredstate where service_name = 'KNOX'
10.delete from clusterservices where service_name = 'KNOX'
11. DELETE from alert_history where alert_definition_id in ( select definition_id from alert_definition where service_name = 'KNOX')
12.DELETE from alert_notice where history_id in ( select alert_id from alert_history where alert_definition_id in ( select definition_id from alert_definition where service_name = 'KNOX'))
13.DELETE from alert_definition where service_name like '%KNOX%'
Note1: I have tried and tested this in Ambari 2.4.x
Note2: Above queries are case sensitive - so use Upper/Lower case for service name.
Very useful information.