I am travelling from Bejing to Karachi, transiting through Hong Kong, flying on Cathay Pacific Airways. I am a Pakistani National holding a Chinese visa. I have gap between the flights about 3 hours mean I will stay Hong Kong airport for 3 hours. Do I need any kind of transit visa? And if yes then how I need to apply?

An application for an entry visa/permit to enter Hong Kong for a visit (leisure, social or business) or transit may be favourably considered if [...] the application is for a transit visa/permit, he/she holds an onward ticket to the place of his/her destination unless the destination is the Mainland of China or the Macao SAR.