Prime minister Boris Johnson was visiting schoolchildren and told a child the UK had to be prepared to leave the EU without a deal.