Widespread adoption of smart IoT devices is accelerating research for new techniques to make IoT applications secure, scalable, energy-efficient, and capable of working in mission-critical use cases, which require an ability to function offline. In this context, the novel combination of distributed ledger technology (DLT) and distributed intelligence (DI) is seen as a practical route towards the decentralisation of IoT architectures. This paper surveys DI techniques in IoT and commences by briefly explaining the need for DI, by proposing a comprehensive taxonomy of DI in IoT. This taxonomy is then used to review existing techniques and to investigate current challenges that require careful attention and consideration. Based on the taxonomy, IoT DI techniques can be classified into five categories based on the factors that support distributed functionality and data acquisition: cloud-computing, mist-computing, distributed-ledger-technology, service-oriented-computing and hybrid. Existing techniques are compared and categorized mainly based on related challenges, and the level of intelligence supported. We evaluate more than thirty current research efforts in this area. We define many significant functionalities that should be supported by DI frameworks and solutions. Our work assists system architects and developers to select the correct low-level communication techniques in an integrated IoT-to-DLT-to-cloud system architecture. The benefits and shortcomings of different DI approaches are presented, which will inspire future work into automatic hybridization and adaptation of DI mechanisms. Finally, open research issues for distributed intelligence in IoT are discussed.