Pakistan off-spinner Mohammed Hafeez has been banned from bowling in international cricket after his action was deemed illegal.