Two boats carrying more than 500 migrants remain stranded in the Mediterranean after Italy and Malta refused to allow them to dock.