I2C Scanner not working properly
Working with the OP, this problem has been solved.
Short version:

De-solder STM32F303K8 Nucleo-32 (NUCLEO-F303K8) board solder bridges SB16 and SB18 when using Mbed I2C functions.
Use the &quot;extended&quot; 4-parameter Mbed i2c.write() call with the STM32F303K8 Nucleo-32 board.

Long version:
As I mentioned in comments (agreeing with Chris Knudsen), we needed to look at the signals. From my own experiences over the years, it can sometimes be important to start with a 'scope, since that can show important details about the shape and voltage levels of the signal waveforms, which cannot be seen with a logic analyser. Then after the analog waveforms have been verified, move on to using a logic analyser.
Using Arduino IDE and libraries for the STM32F303K8 Nucleo board, and running the I2C scanner just for I2C address 0x1 (which didn't exist on the bus), we saw this image of valid I2C activity (yellow = SDA, blue = SCL):

However running an equivalent I2C scanner for Mbed, configured for the STM32F303K8 Nucleo board, we saw this on the I2C bus:

This shows SDA stuck at approximately 2V, which is invalid i.e. not within the allowed range for logic 0 (typically &lt; 0.2 Vdd) or logic 1 (typically &gt; 0.8 Vdd). This is a classic symptom of two output pins driving the same signal in opposite directions.
Looking at the STM32F303K8 Nucleo user guide (UM1956) we see that it actually connects the SCL and SDA pins to other pins, for some kind of compatibility with Arduino Nano analog input functionality.

(Above edited from Table 8 in STM32F303K8 Nucleo user guide (UM1956))

(Above schematic extract from page 33 in STM32F303K8 Nucleo user guide (UM1956))
That means that if the Mbed initialisation code didn't configure pins PA5 and PA6 as inputs without any pull-up/down resistors, then through those solder bridges, pins PA5 and PA6 could affect the I2C signals using pins PB6 and PB7.
De-soldering those two solder bridges allowed I2C signals to be correctly seen, with the Mbed I2C scanner code:

During research, we found this posting about using the STM32F303K8 Nucleo-32 (NUCLEO-F303K8) board with Mbed, which said:

It looks like this device does not support the i2c.write(int data) method. i2c.write(int address, const char *data, int length); works.

Changing from the original Mbed I2C scanner (adapted from the standard Arduino I2C scanner) which used the sequence:
i2c.start();
error = i2c.write(address &lt;&lt; 1);
i2c.stop();

to a different Mbed I2C scanner using this different version of the i2c.write() function call instead:
returnCode = i2c.write((address &lt;&lt; 1),&amp;outByte,1,0);

then this different Mbed I2C scanner worked correctly.
This would be an area for deeper investigation of the Mbed source code and detailed I2C behaviour using a logic analyser, however we ran out of time. By documenting the process so far and what was found to work, I hope this is useful as a starting point for anyone else who wants to take the investigation further.